package com.hk.yajin.function.members.activity.setting;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.TextView;

import com.hk.developmentlib.utills.UiUtil;
import com.hk.yajin.R;
import com.hk.yajin.base.BaseActivity;
import com.hk.yajin.function.members.activity.ContractActivity;
import com.hk.yajin.function.members.activity.LoginAndRegisterActivity;
import com.hk.yajin.manager.UserInfoManager;
import com.hk.yajin.model.UserInfo;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class SettingActivity extends BaseActivity {


    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.tv_acount)
    TextView tvAcount;
    @BindView(R.id.tv_notice_lv)
    TextView tvNoticeLv;
    @BindView(R.id.tv_contract)
    TextView tvContract;
    @BindView(R.id.tv_login_out)
    TextView tvLoginOut;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        ButterKnife.bind(this);
        intiView();
    }

    private void intiView() {
        initToolBar(R.string.user_setting);
    }


    @OnClick({R.id.tv_acount, R.id.tv_notice_lv, R.id.tv_contract, R.id.tv_login_out})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_acount:
                startActivity(AcountSettingActivity.class);
                break;
            case R.id.tv_notice_lv:
                break;
            case R.id.tv_contract:
                startActivity(ContractActivity.class);
                break;
            case R.id.tv_login_out:
                showLoadingView();
                UiUtil.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        hideLoadingView();
                        UserInfoManager.getInstance().exitLogin();
                        startActivity(LoginAndRegisterActivity.class);
                        finish();
                    }
                }, 1500);

                break;
        }
    }
}
